<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<h1>网页计算器</h1>
	<p>
		整数1：<input type="text1" id="one">
	</p>
	<p>
		整数2：<input type="text2" id="two">
	</p>
	<button onclick="change('+')">相加</button>
	<button onclick="change('-')">相减</button>
	<button onclick="change('*')">相乘</button>
	<button onclick="change('/')">相除</button>
	<p>
		结果：<input type="text" id="end">
	</p>

	<script>
	function change(e){
		var text1 = document.querySelector("#one").value;
		text1=Number(text1);
		var text2 = document.querySelector("#two").value;
		text2=Number(text2);
		switch(e){
			case "+":
			document.querySelector(
					"#end").value = text1 + text2;
			break;
			case "-":
			document.querySelector(
					"#end").value = text1 - text2;
			break;
			case "*":
			document.querySelector(
					"#end").value = text1 * text2;
			break;
			case "/":
			document.querySelector(
					"#end").value = text1 / text2;
			break;
		}
	}
	</script>
</body>
</html>